﻿CREATE TABLE [dbo].[PiUserOrganize] (
    [Id]           INT            IDENTITY (1, 1) NOT NULL,
    [UserId]       INT            NULL,
    [OrganizeId]   INT            NULL,
    [RoleId]       INT            NULL,
    [Enabled]      INT            DEFAULT ((1)) NOT NULL,
    [Description]  NVARCHAR (800) NULL,
    [DeleteMark]   INT            DEFAULT ((0)) NOT NULL,
    [CreateOn]     DATETIME       DEFAULT (getdate()) NOT NULL,
    [CreateUserId] NVARCHAR (50)  NULL,
    [CreateBy]     NVARCHAR (50)  NULL,
    [ModifiedOn]   DATETIME       NULL,
    [ModifyUserId] NVARCHAR (50)  NULL,
    [ModifiedBy]   NVARCHAR (50)  NULL,
    CONSTRAINT [PK_PIUSERORGANIZE] PRIMARY KEY NONCLUSTERED ([Id] ASC),
    CONSTRAINT [FK_PiUserOrganize_OrganizeId] FOREIGN KEY ([OrganizeId]) REFERENCES [dbo].[PiUserOrganize] ([Id]),
    CONSTRAINT [FK_UserOrganize_UserId] FOREIGN KEY ([UserId]) REFERENCES [dbo].[PiUser] ([Id])
);

